<template>
  <view class="content">
    <x-nav-bar title="文章详情" />
    <template v-if="detail">
      <view class="tit">{{detail.title}}</view>
      <view class="ss-flex ss-m-y-20">
        <view class="name">童行者-{{title}}</view>
        <view class="time ss-m-l-20">{{sheep.$helper.timeFormat(detail.createTime, 'yyyy-mm-dd')}}</view>
      </view>
      <mp-html :content="detail.content" />
      <view class="ss-m-t-10">阅读量：{{detail.browseCount}}</view>
    </template>
  </view>
</template>

<script setup>
  import sheep from '@/sheep';
  import {
    onLoad,
    onReachBottom
  } from '@dcloudio/uni-app';
  import {
    ref,
    reactive,
  } from 'vue';
  import ArticleApi from '@/sheep/api/promotion/article';

  let title = ref('')
  let detail = ref({})
  onLoad((options) => {
    title.value = options.title
    ArticleApi.getArticle(
      options.id
    ).then(res => {
      if (res.code == 0) {
        detail.value = res.data
      }
    })

  })
</script>

<style lang="scss" scoped>
  .content {
    box-sizing: border-box;
    background: #fff;
    position: absolute;
    min-height: 100%;
    width: 100vw;
    padding: 24rpx;

    .tit {
      font-size: 48rpx;
    }

    .name {
      color: #576b95;
    }
  }
</style>